package com.hzzh.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hzzh.dao.MeetingDAO;
import com.hzzh.dao.MeetingParticipantsDAO;
import com.hzzh.vo.Employee;
import com.hzzh.vo.Meeting;

/**
 * Servlet implementation class ViewMyBookingDetailServlet
 */
@WebServlet("/ViewMyBookingDetailServlet")
public class ViewMyBookingDetailServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public ViewMyBookingDetailServlet() {
		super();
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		int meetingid = Integer.parseInt(request.getParameter("meetingid"));

		MeetingDAO meetingDao = new MeetingDAO();
		MeetingParticipantsDAO parDao = new MeetingParticipantsDAO();

		Meeting meeting = meetingDao.selectById(meetingid);

		List<Employee> employeesList = parDao.selectAllEmployeesByMeetingId(meeting.getMeetingid());
		request.setAttribute("meeting", meeting);
		request.setAttribute("employeesList", employeesList);
		request.getRequestDispatcher("mybookingdetail.jsp").forward(request, response);

	}

}
